package suanfa;

public class removeDuplicates {
    public String removeDuplicates(String _s) {
        StringBuffer ret=new StringBuffer();
        char[] s=_s.toCharArray();
        for(char ch:s){
            if(ret.length()>0 && ch==ret.charAt(ret.length()-1)){
                ret.deleteCharAt(ret.length()-1);
            }else{
                ret.append(ch);
            }
        }
        return ret.toString();
    }
}
